<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>MOMENT</title>
</head>
<body>
    
</body>
<script src="http://cdn.staticfile.org/moment.js/2.24.0/moment.min.js"></script>
<script>
let now=moment();
let now1=moment(undefined);
// 从 2.14.0 开始，也受支持。
let now3=moment([]);
let now2=moment({});
let nowSameFlag=[now1.isSame(now2),now1.isSame(now3),now3.isSame(now,'second')]
//时间相同判断


//语言格式
moment.locale('zh-cn')
console.log('now',now,now1)
console.log('nowSameFlag',nowSameFlag)
//展现格式
let nowStr=now.format('MM-DD-YYYY, HH:mm:ss')
console.log('nowStr',nowStr)


let oldTime=moment('2000-02-02')
console.log('oldTime',oldTime)

//展现格式
let oldTimeStr=oldTime.format('MM-DD-YYYY, HH:mm:ss')
console.log('oldTimeStr',oldTimeStr)


var day = moment.unix(1636333811).format('MM-DD-YYYY, HH:mm:ss');
console.log(day)

var dayDate = new Date();
var dayWrapper = moment(dayDate);
console.log(dayDate.getTime(),dayWrapper,dayWrapper.format('MM-DD-YYYY, HH:mm:ss'))
var day0 =moment(dayDate).weekday(7)//取值和赋值
console.log(dayWrapper.weekday(),day0.format('MM-DD-YYYY, HH:mm:ss'))
// moment().get('year');
// moment().get('month');  // 0 至 11
// moment().get('date');
// moment().get('hour');
// moment().get('minute');
// moment().get('second');
// moment().get('millisecond');
</script>


</html>